package com.naiterui.ehp.bs.patient.feign;

import com.naiterui.common.repository.page.PageVO;
import com.naiterui.ehp.bp.bo.consult.CommentBO;
import com.naiterui.ehp.bp.bo.consult.CommentComplaintBO;
import com.naiterui.ehp.bp.bo.consult.CommentDetailBO;
import com.naiterui.ehp.bp.bo.consult.ComplaintBO;
import com.naiterui.ehp.bp.support.config.FeignConfiguration;
import com.naiterui.ehp.bp.support.exception.BusinessException;
import com.naiterui.ehp.bs.patient.vo.common.HospitalVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * @Description 医生服务
 * @Author gongbaoqiang
 * @Date 2020/7/1 5:14 PM
 */
@FeignClient(name = "doctor", url = "${ehp.domain.ad}", configuration = FeignConfiguration.class)
public interface IDoctorFeignClient {

    /**
     * 医生评价列表
     *
     * @param doctorId
     * @param page
     * @param num
     * @return
     * @throws BusinessException
     */
    @PostMapping("inner/consult/comment/list")
    PageVO<CommentDetailBO> findCommentByDoctorId(@RequestParam("doctorId") Long doctorId, @RequestParam("page") int page,
                                                  @RequestParam("num") int num) throws BusinessException;

    /**
     * 提交评价
     *
     * @param commentBO
     * @throws BusinessException
     */
    @PostMapping("inner/consult/comment/submit")
    Long submitComment(@RequestBody CommentBO commentBO) throws BusinessException;

    /**
     * 提交投诉
     *
     * @param complaintBO
     * @throws BusinessException
     */
    @PostMapping("inner/consult/complaint/submit")
    void submitComplaint(@RequestBody ComplaintBO complaintBO) throws BusinessException;

    /**
     * 发送会话评价通知
     *
     * @throws BusinessException
     */
    @PostMapping("inner/notify/consult/comment/send")
    void sendCommentNotice(@RequestParam("doctorId") Long doctorId, @RequestParam("commentId") Long commentId) throws BusinessException;

    /**
     * 发送患者填写随访表单通知 应用内通知
     *
     * @throws BusinessException
     */
    @PostMapping("inner/notify/followup/send")
    void sendFollowUpNotice(@RequestParam("doctorId") Long doctorId, @RequestParam("followUpId") Long followUpId, @RequestParam("type") Integer type)
            throws BusinessException;

    /**
     * 获取医生好评率
     *
     * @param doctorIds
     * @return
     * @throws BusinessException
     */
    @PostMapping("inner/consult/comment/praise/rate")
    Map<Long, String> getPraiseRate(@RequestBody List<Long> doctorIds) throws BusinessException;

    /**
     * 查询会话是否已经评价
     *
     * @param consultSessionId
     * @param type
     * @return
     * @throws BusinessException
     */
    @PostMapping("inner/consult/comment/exist")
    Boolean existCommentByConsultSession(@RequestParam("consultSessionId") Long consultSessionId, @RequestParam("consultType") Integer type)
            throws BusinessException;

    /**
     * 查询会话是否已经评价
     *
     * @param consultSessionId
     * @param type
     * @return
     * @throws BusinessException
     */
    @PostMapping("inner/consult/complaint/exist")
    Boolean existComplaintByConsultSession(@RequestParam("consultSessionId") Long consultSessionId, @RequestParam("consultType") Integer type)
            throws BusinessException;

    /**
     * 根据城市和名称搜索医院
     *
     * @param cityName
     * @param keyword
     * @return
     * @throws BusinessException
     */
    @PostMapping("inner/hospital/city/list")
    List<HospitalVO> searchHospitalByCity(@RequestParam("cityName") String cityName, @RequestParam("keyword") String keyword)
            throws BusinessException;

    /**
     * 查询会话是否已经评价
     */
    @GetMapping("inner/charge")
    Map<Long, Integer> doctorCharge(@RequestParam("doctorIds") String doctorIds, @RequestParam("type") Integer type);

    /**
     * 验证身份证、姓名对应合法性
     *
     * @param idCard
     * @param name
     * @return
     * @throws BusinessException
     */
    @GetMapping("inner/doctor/idcard/verify")
    Void verifyIdCard(@RequestParam("idCard") String idCard, @RequestParam("name") String name) throws BusinessException;

    /**
     * 查询会话是否已经评价投诉
     *
     * @param consultSessionId
     * @param type
     * @return
     * @throws BusinessException
     */
    @GetMapping("inner/consult/getCommentComplaint")
    CommentComplaintBO getCommentComplaint(@RequestParam("consultSessionId") Long consultSessionId,
                                           @RequestParam("consultType") Integer type);
}
